using System;
using Microsoft.SPOT;
using System.IO;
using System.Text;

namespace mfRCF.Core.Extensions
{
    public static class mfResponseExtensions
    {
        public static void WriteString(this mfIHttpResponse response, String value)
        {
            var responseBytes = Encoding.UTF8.GetBytes(value);
            response.WriteBytes(responseBytes);
            responseBytes = null;
        }

        public static void WriteStream(this mfIHttpResponse response, Stream value) 
        {
          var responseBytes = value.ReadAllBytes();
          response.WriteBytes(responseBytes);
          responseBytes = null;
        }

        public static void WriteBytes(this mfIHttpResponse response, byte[] responseBytes)
        {
            response.OutputStream.Write(responseBytes, 0, responseBytes.Length);
            responseBytes = null;
        }

    }
}
